package com.pd.kit;

import javax.annotation.Resource;
import java.io.*;
import java.util.Properties;

/**
 * Created by dong peng
 * DATE : 2016/12/24
 * TIME : 23:01.
 *
 * 读取properties文件处理类
 */


public class PropKit {

    private static Properties prop = null;

    private PropKit(){}

    /**
     * 加载指定的properties文件到Properties对象
     *
     * @param fileName
     * @return
     */
    public static Properties use(String fileName){
        prop = new Properties();
        try {
            String absPath = PropKit.class.getResource("/").getPath();
            String path = absPath + fileName;
            InputStream in = new BufferedInputStream(new FileInputStream(path));
            prop.load(in);
            in.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }catch (IOException e) {
            e.printStackTrace();
        }
        return prop;
    }

}
